﻿using HomagChina.CCT.DataTypeModel;
using HomagChina.CCT.ViewModels;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using Proxy;
using System.Collections.ObjectModel;
using static HomagChina.CCT.ProcessResourceInternal;
using static HomagChina.CCT.Utility;
using Application = System.Windows.Application;

namespace HomagChina.CCT.Router
{
    public class SettingsRoute
    {
        public RouterItemDataModel SettingsRouteModel { get; set; }
        private CommonHandle Handle_Common;
        private SearchInfoHandle Handle_Search;

        public SettingsRoute()
        {
            Handle_Common = new CommonHandle();
            Handle_Search = new SearchInfoHandle();
            var model = new SettingsViewModel();
            SettingsRouteModel = new RouterItemDataModel()
            {
                ID = "Settings",
                viewLabel = GetLocalText("Settings"),
                viewName = "Settings",
                keepalive = false,
                viewModelName = "SettingsViewModel",
                ViewModel = model,
                userControl = GetUserControlInstance("Settings"),
                Image = null,
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {  
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Exit"),
                    //    Position = 12,
                    //    Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                    //    Command = new RelayCommand(
                    //        () => { Application.Current.Shutdown(); })
                    //},
                    new FunctionKeyBarItemDataModel() {
                        Header= GetLocalText("Add"),
                        Position = 9,
                        Icon = GetIconBrush(Icon.Plus,ImageDecoration.Box),
                        Command=new RelayCommand(
                            ()=>model.OpenDialog( GetUserControlInstance("Settings").DataContext))
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =  GetLocalText("Info"),
                        Position = 1,
                        Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                        Command = new RelayCommand(
                            () => { Handle_Common.OpenInformationCommand(Handle_Search.GetSystemInfoMation()); })
                    }
                }
            };
            SettingsRouteModel.userControl.DataContext = model;
        }
    }
}